# -*- coding: utf-8 -*-
import pymysql

db = pymysql.connect(
    host='127.0.0.1',  # 数据库ip地址
    user='root',  # 用户名
    passwd='cnxjs@20020921',  # 密码
    db='score_analysis_system',  # 数据库名称
    port=3306  # 端口号
)
cursor = db.cursor()  # 生成游标对象


def delete_all_tables(c):
    sql1 = '''
        delete from scores
    '''
    c.execute(sql1)
    db.commit()
    sql2 = '''
        delete from parents
    '''
    c.execute(sql2)
    db.commit()
    sql3 = '''
        delete from students
    '''
    c.execute(sql3)
    db.commit()
    sql4 = '''
        delete from courses
    '''
    c.execute(sql4)
    db.commit()
    sql5 = '''
        delete from teachers
    '''
    c.execute(sql5)
    db.commit()


delete_all_tables(cursor)